package com.hzw.service.impl;

import com.hzw.config.DatabaseContextHolder;
import com.hzw.model.Channel;
import com.hzw.repository.ChannelRepository;
import com.hzw.service.ChannelService;
import com.hzw.util.DbUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 栏目业务层接口实现类
 */
@Service
public class ChannelServiceImpl implements ChannelService {

    @Autowired
    private ChannelRepository channelRepository;

    @Override
    public List<Channel> findChannel() {
        // 指定数据源
        DatabaseContextHolder.setDBKey(DbUtil.DB_ARTICLE);
        return channelRepository.findAll();
    }
}
